#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/init.h>
#include <linux/sched.h>
#if 1
static int print_pid(void) {
	struct task_struct *task;
	struct task_struct *p;
	struct list_head *pos;
	int count = 0;
	
	printk("Search for each task-------->\n");
	task = &init_task;
	list_for_each(pos, &task->tasks) {
		p = list_entry(pos, struct task_struct, tasks);
		count++;
		printk("%d -----------> %s\n", p->pid, p->comm);
	}
	printk("the number of process is %d\n", count);
	return 0;
}
#endif

static int __init hello_init(void) {
	printk("<1> Hello World\n");
	print_pid();
	return 0;
}

static void __exit hello_exit(void) {
	printk("<1> Goodbey\n");
	return ;
}

MODULE_LICENSE("GPL");
module_init(hello_init);
module_exit(hello_exit);
